package com.mimiwang.article.controller;

import com.mimiwang.article.entity.ArticleCategoryRelationEntity;
import com.mimiwang.article.service.ArticleCategoryRelationService;
import com.mimiwang.common.utils.PageUtils;
import com.mimiwang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author huangqicai
 * @email 1355518552@qq.com
 * @date 2022-10-07 18:54:56
 */
@RestController
@RequestMapping("member/articlecategoryrelation")
public class ArticleCategoryRelationController {
    @Autowired
    private ArticleCategoryRelationService articleCategoryRelationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = articleCategoryRelationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		ArticleCategoryRelationEntity articleCategoryRelation = articleCategoryRelationService.getById(id);

        return R.ok().put("articleCategoryRelation", articleCategoryRelation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ArticleCategoryRelationEntity articleCategoryRelation){
		articleCategoryRelationService.save(articleCategoryRelation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ArticleCategoryRelationEntity articleCategoryRelation){
		articleCategoryRelationService.updateById(articleCategoryRelation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		articleCategoryRelationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
